package cloud.estate.community.controller;

import cloud.estate.commons.bean.Community;
import cloud.estate.commons.util.JsonResult;
import cloud.estate.community.service.communityService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/community")
public class CommunityController {
    @Resource
    private communityService communityService;
    @PostMapping("/addOneCommunity")
    public JsonResult addOneCommunity(Community community){
        return communityService.addOneCommunity(community);
    }
    @PostMapping("/deleteOneCommunity")
    public JsonResult deleteOneCommunity(String id){
        return communityService.deleteOneCommunity(id);
    }
    @PostMapping("/updateOneCommunity")
    public JsonResult updateOneCommunity(Community community){
        return communityService.updateOneCommunity(community);
    }
    @GetMapping("/findOneCommunity")
    public JsonResult findOneCommunity(String id){
        return communityService.findOneCommunity(id);
    }
    @GetMapping("/findAllCommunity")
    public JsonResult findAllCommunity(){
        return communityService.findAllCommunity();
    }
}
